<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script type="module">
			import render from "./index.js";

			// 定义一个组件
			const myComponent = {
				render() {
					return {
						target: "div",
						props: { color: "red", fontSize: "16px", name: "test" },
						children: [
							{
								target: "span",
								props: {
									onclick: () => {
										console.log("test");
									},
								},
								children: "click me",
							},
						],
					};
				},
			};

			// 使用组件
			const vnode = {
				target: myComponent,
			};

			// 渲染虚拟DOM
			render(vnode, document.body);
		</script>
	</body>
</html>
